<?php

/**
 * Base class for the BOB framework.
 *
 * Both the system module classes and user module classes inherits this class.
 * @package BOB
 * @author  Thato Selebogo
 */
class object_auto_loader
{
        public function __construct()
        {
            $this->autoloader();
        }

/**
 * Wraps the private __autoload() function.
 *
 * Code adapted from http://php.net/manual/en/language.oop5.autoload.php
 * @package BOB
 * @access Protected
 * @param string $className Class or Interface name automatically passed to this function by the PHP Interpreter
 * @todo autoloading from an online repository
 * @author  Thato Selebogo
 */

       public function autoloader() {
   function __autoload($className) {
    //Directories containing the classes
        $directories = array(
        $_SERVER['DOCUMENT_ROOT'].'/stellogoogle/eventsmanager/server/model/',
        $_SERVER['DOCUMENT_ROOT'].'/stellogoogle/eventsmanager/'

        );
        //file naming format
        $fileNameFormat = '%s.php';

        foreach($directories as $directory){
               $path = $directory.sprintf($fileNameFormat, $className);
                if(!file_exists($path)){
                        throw new Exception('The specified file cannot be found!');
                        }
                             include_once $path;
                        return;
         }
}
}


}

?>